package sys.controller;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sys.core.ResponseResult;
import sys.entity.CountEntity;
import sys.entity.StudentEntity;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/count")
@Api(tags = "统计分析")
public class CountController {

    @PostMapping("/data")
    public ResponseResult add() {
        CountEntity countEntity = new CountEntity();
        countEntity.setTeacher("张三");
        List<String> list = new ArrayList<>();
        list.add("关羽");
        list.add("张飞");
        list.add("曹操");
        countEntity.setTeachers(list);
        return ResponseResult.success (countEntity);
    }
    @PostMapping("/data1")
    public ResponseResult a() {
        StudentEntity studentEntity = new StudentEntity();
        studentEntity.setAddress("山东");
        studentEntity.setName("张三");
        studentEntity.setAge(21);
        StudentEntity studentEntity1 = new StudentEntity();
        studentEntity1.setAddress("北京");
        studentEntity1.setName("李四");
        studentEntity1.setAge(25);

        List<StudentEntity> list = new ArrayList<>();
        list.add(studentEntity);
        list.add(studentEntity1);
        return ResponseResult.success (list);
    }


}
